import request from '@/utils/request'
// 添加接口
export const letterSendService = (data) => {
  return request.post('api/letter/send', data)
}

// 暂存接口
export const letterSaveService = (data) => {
  return request.post('api/letter/save', data)
}

// 获取用户已经发送的信件
export const letterGetSentInfoService = () => {
  return request.get('api/letter/get-sent-info')
}

// 获取自己的信件详细信息
export const letterGetSentInfoByIdService = (id) => {
  return request.get('api/letter/get-sent-info-by-id', {
    params: {
      id
    }
  })
}

// 获取等待发出的信件
export const letterGetWaitingSendInfoService = () => {
  return request.get('api/letter/get-waiting-send-info')
}

// 获取公开信的信件
export const letterGetSentAndPubInfoService = () => {
  return request.get('api/letter/get-sent-and-pub-info')
}

// 获取公开信的信件limit
export const letterGetSentAndPubInfoLimitService = (params) => {
  return request.get('api/letter/get-sent-and-pub-info-limit', {
    params
  })
}

// 获取公开的信件详细信息
export const letterGetSentAndPubInfoByIdService = (id) => {
  return request.get('api/letter/get-sent-and-pub-info-by-id', {
    params: {
      id
    }
  })
}

// 获取当前登录用户的统计数据
export const letterGetCountOnCurUserService = () => {
  return request.get('api/letter/get-count-on-cur-user')
}

// 获取暂存的信件
export const letterGetSaveInfoService = (select) => {
  if (select === 'undefined') {
    select = null
  }
  return request.get('api/letter/get-save-info', {
    params: {
      select: select
    }
  })
}

// 删除在暂存的信件
export const letterDelSaveInfoService = (id) => {
  return request.post('api/letter/del-save-info', { id })
}

// 通过id拿到暂存信
export const letterGetSaveInfoByIdService = (id) => {
  return request.post('api/letter/get-save-info-by-id', { id })
}

// 获取个人list页面
export const letterGetListService = () => {
  return request.get('api/letter/get-list')
}

// 提交Bug
export const letterSubmitBugService = (letter) => {
  return request.post('/api/letter/submit-bug', letter)
}

// 获取反馈
export const letterGetBugsService = () => {
  return request.get('/api/letter/sys/get-bugs')
}
// 获取反馈
export const letterGetBugsNoSolveService = () => {
  return request.get('/api/letter/sys/get-bugs-no-solve')
}

// 获整个网站待投递的信件
export const letterGetWaitingSendCountService = () => {
  return request.get('/api/letter/get-waiting-send-count')
}
// 获取整个网站已经投递的信件
export const letterGetSentCountService = () => {
  return request.get('/api/letter/get-sent-count')
}
// 修改已经解决的bug
export const letterChangeLetterBugService = (letterBug) => {
  return request.post('/api/letter/sys/change-letter-bug', letterBug)
}
